package simple08;

import simple08.bag.Bag;
import simple08.bag.CheckedBagDecorator;
import simple08.bag.ReinforceBagDecorator;
import simple08.bag.SpeedBagDecorator;
import simple08.factory.AppleFactory;
import simple08.factory.FruitFactory;
import simple08.fruit.Fruit;

/**
 * 装饰器模式
 */
public class Simple {
    public static void main(String[] args) {
        FruitFactory fruitFactory = new AppleFactory();
//    得到水果
        Fruit fruit = ((AppleFactory) fruitFactory).getFruit();
        fruit.fruit();
//    得到包装
        Bag bag = ((AppleFactory) fruitFactory).getBag();

//        现需要 增加装饰
        bag = new CheckedBagDecorator(bag);
        bag = new ReinforceBagDecorator(bag);
        bag = new SpeedBagDecorator(bag);

        bag.getBag();
    }
}
